package com.wcgksoft.service.redis;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(value ="paymentListener")
public class PaymentListener implements MessageListener {

  @Override
  @Transactional
  public void onMessage(Message message, byte[] pattern) {
    // 过期事件处理流程
    byte[] body = message.getBody();// 请使用valueSerializer
    byte[] channel = message.getChannel();
    //设置监听频道
    String topic = new String(channel);
    //key
    String itemValue = new String(body);
    System.out.println("频道"+topic);
    System.out.println("过期的键值对的K:"+itemValue);

  }

}
